package com.zhou.common.exception;


import com.zhou.common.model.response.ResultCode;

/**
 * 自定义异常类
 * @author Hao.
 * @version 1.0
 * @date 2020/4/4 11:38
 */
public class CustomException extends RuntimeException {

    private ResultCode resultCode;

    public CustomException(ResultCode resultCode){

        // 异常信息为【错误代码】+【错误信息】
        super(String.format("错误代码：%s，错误信息：%s", resultCode.code(), resultCode.message()));
        this.resultCode = resultCode;
    }

    public ResultCode getResultCode() {
        return resultCode;
    }

    public void setResultCode(ResultCode resultCode) {
        this.resultCode = resultCode;
    }
}
